#include "Texture.h"
#include "DDSTextureLoader.h"


Texture::Texture()
{
	m_pTexture = 0;
}



HRESULT Texture::LoadTexutureToShaderResource(ID3D11Device* device, const char* path)
{
	const unsigned int strLength = strlen(path) + 1;
	unsigned int returnValue;
	wchar_t* wc = new wchar_t[strLength];
	mbstowcs_s(&returnValue, wc, strLength, path, strLength );
	HRESULT hr = CreateDDSTextureFromFile(device, wc, NULL, &m_pTexture);

	delete []wc;
	return hr;
}
void Texture::ShutDown(void)
{
	if (m_pTexture)
	{
		m_pTexture->Release();
		m_pTexture = 0;
	}

}

ID3D11ShaderResourceView* Texture::GetTexture()
{
	return m_pTexture;
}